package com.example.leddemo.activity;

import com.example.leddemo.R;
import com.example.leddemo.R.layout;
import com.example.leddemo.R.menu;
import com.example.leddemo.widget.AutoScrollTextView;
import com.example.leddemo.widget.MyScroller;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;

public class ScroActivity extends Activity {

	private String text;
	private int size;
	private int color;
	private AutoScrollTextView show;
	private float speed = 5;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_scrotext);
		init();
		initView();
		initListener();
	}

	private void initView() {
		show = (AutoScrollTextView) findViewById(R.id.tv_show);
		show.setText(text);
		show.setTextSize(size);
		show.setTextColor(color);
		show.setInterval(speed);
		show.init(getWindowManager());
		show.startScroll();
	}

	private void initListener() {
	}

	private void init() {
		Intent intent = getIntent();
		text = intent.getStringExtra("text");
		size = intent.getIntExtra("size",0);
		color = intent.getIntExtra("color", Color.WHITE);
		speed =	intent.getFloatExtra("speed", 5);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.scro_text, menu);
		return true;
	}

}
